package com.senseuni.da.http

import com.senseuni.da.BuildConfig
import com.senseuni.da.MyApplication
import com.senseuni.da.utils.AppUtils
import java.util.*

/**
 * ================================================
 * Copyright (c) 2020 All rights reserved
 * 描述：
 * Author: Yuri
 * Date： Date: 2024/12/7
 * ================================================
 */
open class BaseRequest {
    var deviceId:String = ""
    var idType:String = ""
    var key:String = ""
    var modelCode:String = ""
    var stochastic:String = ""
    var versionCode:Int = 0

    fun init() {
        val did:String
        if (MyApplication.DEVICE_ID.isEmpty()) {
            did = AppUtils.getDeviceId()
            MyApplication.DEVICE_ID = did;
        } else {
            did = MyApplication.DEVICE_ID
        }
        this.deviceId = AppUtils.base64Encode(did)
        this.idType = "imei"
        this.stochastic = UUID.randomUUID().toString()
        this.key = AppUtils.generateKey(stochastic, did)
        this.versionCode = BuildConfig.VERSION_CODE
        this.modelCode = "test001"
    }
}